<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小黑记事本</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }
        .container {
            max-width: 360px; /* 进一步减小容器宽度 */
            width: 100%;
            padding: 15px;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
            text-align: center;
        }
        h1 {
            color: #333;
            font-size: 1.6em; /* 再次减小标题大小 */
            margin-bottom: 15px;
        }
        .input-group {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-bottom: 15px;
        }
        input[type="text"] {
            width: 70%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 0.9em; /* 减小输入框字体大小 */
        }
        button {
            background-color: #007bff; /* 蓝色按钮 */
            color: white;
            padding: 8px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.9em; /* 减小按钮字体大小 */
            transition: background-color 0.3s;
        }
        button:hover {
            background-color: #0056b3; /* 悬停时的深蓝色 */
        }
        ul {
            list-style-type: none;
            padding: 0;
            margin: 0;
        }
        li {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 8px;
            border-bottom: 1px solid #ddd;
            font-size: 0.9em; /* 减小任务项字体大小 */
        }
        li:last-child {
            border-bottom: none;
        }
        .delete-button {
            background-color: #333;
            color: white;
            border: none;
            padding: 5px 8px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 1em; /* 调整删除按钮大小 */
            transition: background-color 0.3s;
        }
        .delete-button:hover {
            background-color: #555;
        }
        .footer {
            margin-top: 15px;
            text-align: center;
        }
        .footer p {
            color: #777;
            margin-bottom: 10px;
            font-size: 0.9em; /* 减小统计信息字体大小 */
        }
        .footer button {
            background-color: #007bff; /* 蓝色按钮 */
            color: white;
            padding: 8px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.9em; /* 减小清空按钮字体大小 */
            transition: background-color 0.3s;
        }
        .footer button:hover {
            background-color: #0056b3; /* 悬停时的深蓝色 */
        }
    </style>
</head>
<body>
<div id="app" class="container">
    <h1>小黑记事本</h1>
    <div class="input-group">
        <input type="text" v-model="newTask" placeholder="请输入任务">
        <button @click="addTask">添加任务</button>
    </div>
    <ul>
        <li v-for="(task, index) in tasks" :key="index">
            {{ task }}
            <button class="delete-button" @click="removeTask(index)">×</button>
        </li>
    </ul>
    <div class="footer">
        <p>合计：{{ totalTasks }}</p>
        <button @click="clearAllTasks">清空任务</button>
    </div>
</div>

<script src="./js/vue.js"></script>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                newTask: '',
                tasks: [],
                totalTasks: 0
            };
        },
        methods: {
            addTask() {
                if (this.newTask.trim()) {
                    this.tasks.push(this.newTask);
                    this.newTask = '';
                    this.totalTasks++;
                }
            },
            removeTask(index) {
                this.tasks.splice(index, 1);
                this.totalTasks--;
            },
            clearAllTasks() {
                this.tasks = [];
                this.totalTasks = 0;
            }
        }
    });
</script>
</body>
</html>